<link rel="stylesheet" type="text/css" href="<?php echo css_url().'vertical_nav_menu_black.css'?>">

<div class="left-nav-bar-container">
    <div class ="vertical-nav-bar">
        <div id="post-applicants-management" class="nav-bar-entity" selected>Post Applicants</div>
        <div id="post-content-management" class="nav-bar-entity">Post Content</div>
        <div id="security-management" class="nav-bar-entity">Post Security</div>
    </div>
</div>
<script>
    $(document).ready(function(){    
        $('.nav-bar-entity').on('click',function(){
            if($(this).attr('class') != "nav-bar-entity expanded"){
                $(this).siblings('.nav-bar-tab').hide("fast");
            }
        });

        $("#post-content-management").on('click',function(){
            $(".nav-bar-entity").attr('class', 'nav-bar-entity');
            $(this).attr('class', 'nav-bar-entity selected');
            $.get("<?php echo site_url().'/user_group2/posts/manage_post_content/'.$Post['PostID'];?>", function(data){
                    $(".content-container").empty();
                    $(".content-container").html(data);
            });
        });
        
        $("#post-applicants-management").on('click',function(){
            $(".nav-bar-entity").attr('class', 'nav-bar-entity');
            $(this).attr('class', 'nav-bar-entity selected');
            $.get("<?php echo site_url().'/user_group2/posts/manage_post_applicants/'.$Post['PostID'].'/Pending';?>", function(data){
                    $(".content-container").empty();
                    $(".content-container").html(data);   
            });
        });
        
        <?php
        $section = $_GET['section'];
        if ($section == "post-content") {
            echo '$("#post-content-management").click();';
        } elseif ($section == "post-applicants"  || empty($_GET)) {
            echo '$("#post-applicants-management").click();';
        }
        ?>
    });
    
</script>